\(\int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx\) [305]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 195 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=a^3 (4 A b+a B) x+\frac {b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b \left (6 a^3 A-12 a A b^2-17 a^2 b B-2 b^3 B\right ) \tan (c+d x)}{3 d}-\frac {b^2 \left (6 a^2 A-3 A b^2-8 a b B\right ) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 a A-b B) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \]

[Out]

a^3*(4*A*b+B*a)*x+1/2*b*(12*A*a^2*b+A*b^3+8*B*a^3+4*B*a*b^2)*arctanh(sin(d*x+c))/d+a*A*(a+b*sec(d*x+c))^3*sin(
d*x+c)/d-1/3*b*(6*A*a^3-12*A*a*b^2-17*B*a^2*b-2*B*b^3)*tan(d*x+c)/d-1/6*b^2*(6*A*a^2-3*A*b^2-8*B*a*b)*sec(d*x+
c)*tan(d*x+c)/d-1/3*b*(3*A*a-B*b)*(a+b*sec(d*x+c))^2*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.39 (sec) , antiderivative size = 195, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.207, Rules used = {4110, 4141, 4133, 3855, 3852, 8} \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=a^3 x (a B+4 A b)-\frac {b^2 \left (6 a^2 A-8 a b B-3 A b^2\right ) \tan (c+d x) \sec (c+d x)}{6 d}+\frac {b \left (8 a^3 B+12 a^2 A b+4 a b^2 B+A b^3\right ) \text {arctanh}(\sin (c+d x))}{2 d}-\frac {b \left (6 a^3 A-17 a^2 b B-12 a A b^2-2 b^3 B\right ) \tan (c+d x)}{3 d}-\frac {b (3 a A-b B) \tan (c+d x) (a+b \sec (c+d x))^2}{3 d}+\frac {a A \sin (c+d x) (a+b \sec (c+d x))^3}{d} \]

[In]

Int[Cos[c + d*x]*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x]),x]

[Out]

a^3*(4*A*b + a*B)*x + (b*(12*a^2*A*b + A*b^3 + 8*a^3*B + 4*a*b^2*B)*ArcTanh[Sin[c + d*x]])/(2*d) + (a*A*(a + b
*Sec[c + d*x])^3*Sin[c + d*x])/d - (b*(6*a^3*A - 12*a*A*b^2 - 17*a^2*b*B - 2*b^3*B)*Tan[c + d*x])/(3*d) - (b^2
*(6*a^2*A - 3*A*b^2 - 8*a*b*B)*Sec[c + d*x]*Tan[c + d*x])/(6*d) - (b*(3*a*A - b*B)*(a + b*Sec[c + d*x])^2*Tan[
c + d*x])/(3*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4110

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)*(csc[(e_.) + (f_.)*(x_)]*
(B_.) + (A_)), x_Symbol] :> Simp[a*A*Cot[e + f*x]*(a + b*Csc[e + f*x])^(m - 1)*((d*Csc[e + f*x])^n/(f*n)), x]
+ Dist[1/(d*n), Int[(a + b*Csc[e + f*x])^(m - 2)*(d*Csc[e + f*x])^(n + 1)*Simp[a*(a*B*n - A*b*(m - n - 1)) + (
2*a*b*B*n + A*(b^2*n + a^2*(1 + n)))*Csc[e + f*x] + b*(b*B*n + a*A*(m + n))*Csc[e + f*x]^2, x], x], x] /; Free
Q[{a, b, d, e, f, A, B}, x] && NeQ[A*b - a*B, 0] && NeQ[a^2 - b^2, 0] && GtQ[m, 1] && LeQ[n, -1]

Rule 4133

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) +
 (a_)), x_Symbol] :> Simp[(-b)*C*Csc[e + f*x]*(Cot[e + f*x]/(2*f)), x] + Dist[1/2, Int[Simp[2*A*a + (2*B*a + b
*(2*A + C))*Csc[e + f*x] + 2*(a*C + B*b)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, e, f, A, B, C}, x]

Rule 4141

Int[((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(C_.))*(csc[(e_.) + (f_.)*(x_)]*(b_.) +
 (a_))^(m_.), x_Symbol] :> Simp[(-C)*Cot[e + f*x]*((a + b*Csc[e + f*x])^m/(f*(m + 1))), x] + Dist[1/(m + 1), I
nt[(a + b*Csc[e + f*x])^(m - 1)*Simp[a*A*(m + 1) + ((A*b + a*B)*(m + 1) + b*C*m)*Csc[e + f*x] + (b*B*(m + 1) +
 a*C*m)*Csc[e + f*x]^2, x], x], x] /; FreeQ[{a, b, e, f, A, B, C}, x] && NeQ[a^2 - b^2, 0] && IGtQ[2*m, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\int (a+b \sec (c+d x))^2 \left (-a (4 A b+a B)-b (A b+2 a B) \sec (c+d x)+b (3 a A-b B) \sec ^2(c+d x)\right ) \, dx \\ & = \frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b (3 a A-b B) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {1}{3} \int (a+b \sec (c+d x)) \left (-3 a^2 (4 A b+a B)-b \left (9 a A b+9 a^2 B+2 b^2 B\right ) \sec (c+d x)+b \left (6 a^2 A-3 A b^2-8 a b B\right ) \sec ^2(c+d x)\right ) \, dx \\ & = \frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b^2 \left (6 a^2 A-3 A b^2-8 a b B\right ) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 a A-b B) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {1}{6} \int \left (-6 a^3 (4 A b+a B)-3 b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \sec (c+d x)+2 b \left (6 a^3 A-12 a A b^2-17 a^2 b B-2 b^3 B\right ) \sec ^2(c+d x)\right ) \, dx \\ & = a^3 (4 A b+a B) x+\frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b^2 \left (6 a^2 A-3 A b^2-8 a b B\right ) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 a A-b B) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{2} \left (b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right )\right ) \int \sec (c+d x) \, dx-\frac {1}{3} \left (b \left (6 a^3 A-12 a A b^2-17 a^2 b B-2 b^3 B\right )\right ) \int \sec ^2(c+d x) \, dx \\ & = a^3 (4 A b+a B) x+\frac {b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b^2 \left (6 a^2 A-3 A b^2-8 a b B\right ) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 a A-b B) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {\left (b \left (6 a^3 A-12 a A b^2-17 a^2 b B-2 b^3 B\right )\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d} \\ & = a^3 (4 A b+a B) x+\frac {b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \text {arctanh}(\sin (c+d x))}{2 d}+\frac {a A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b \left (6 a^3 A-12 a A b^2-17 a^2 b B-2 b^3 B\right ) \tan (c+d x)}{3 d}-\frac {b^2 \left (6 a^2 A-3 A b^2-8 a b B\right ) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 a A-b B) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(469\) vs. \(2(195)=390\).

Time = 8.14 (sec) , antiderivative size = 469, normalized size of antiderivative = 2.41 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {\cos ^5(c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \left (12 a^3 (4 A b+a B) (c+d x)-6 b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+6 b \left (12 a^2 A b+A b^3+8 a^3 B+4 a b^2 B\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^3 (3 A b+(12 a+b) B)}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {2 b^4 B \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}+\frac {8 b^2 \left (6 a A b+9 a^2 B+b^2 B\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+\frac {2 b^4 B \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}-\frac {b^3 (3 A b+(12 a+b) B)}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {8 b^2 \left (6 a A b+9 a^2 B+b^2 B\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+12 a^4 A \sin (c+d x)\right )}{12 d (b+a \cos (c+d x))^4 (B+A \cos (c+d x))} \]

[In]

Integrate[Cos[c + d*x]*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x]),x]

[Out]

(Cos[c + d*x]^5*(a + b*Sec[c + d*x])^4*(A + B*Sec[c + d*x])*(12*a^3*(4*A*b + a*B)*(c + d*x) - 6*b*(12*a^2*A*b
+ A*b^3 + 8*a^3*B + 4*a*b^2*B)*Log[Cos[(c + d*x)/2] - Sin[(c + d*x)/2]] + 6*b*(12*a^2*A*b + A*b^3 + 8*a^3*B +
4*a*b^2*B)*Log[Cos[(c + d*x)/2] + Sin[(c + d*x)/2]] + (b^3*(3*A*b + (12*a + b)*B))/(Cos[(c + d*x)/2] - Sin[(c
+ d*x)/2])^2 + (2*b^4*B*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2])^3 + (8*b^2*(6*a*A*b + 9*a^2*B
+ b^2*B)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] - Sin[(c + d*x)/2]) + (2*b^4*B*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2
] + Sin[(c + d*x)/2])^3 - (b^3*(3*A*b + (12*a + b)*B))/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2])^2 + (8*b^2*(6*a*A
*b + 9*a^2*B + b^2*B)*Sin[(c + d*x)/2])/(Cos[(c + d*x)/2] + Sin[(c + d*x)/2]) + 12*a^4*A*Sin[c + d*x]))/(12*d*
(b + a*Cos[c + d*x])^4*(B + A*Cos[c + d*x]))

Maple [A] (verified)

Time = 3.90 (sec) , antiderivative size = 209, normalized size of antiderivative = 1.07

method result size
derivativedivides \(\frac {a^{4} A \sin \left (d x +c \right )+B \,a^{4} \left (d x +c \right )+4 A \,a^{3} b \left (d x +c \right )+4 B \,a^{3} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 A \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 B \tan \left (d x +c \right ) a^{2} b^{2}+4 A \tan \left (d x +c \right ) a \,b^{3}+4 B a \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,b^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,b^{4} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(209\)
default \(\frac {a^{4} A \sin \left (d x +c \right )+B \,a^{4} \left (d x +c \right )+4 A \,a^{3} b \left (d x +c \right )+4 B \,a^{3} b \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 A \,a^{2} b^{2} \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+6 B \tan \left (d x +c \right ) a^{2} b^{2}+4 A \tan \left (d x +c \right ) a \,b^{3}+4 B a \,b^{3} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )+A \,b^{4} \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )-B \,b^{4} \left (-\frac {2}{3}-\frac {\sec \left (d x +c \right )^{2}}{3}\right ) \tan \left (d x +c \right )}{d}\) \(209\)
parallelrisch \(\frac {-108 b \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \left (A \,a^{2} b +\frac {1}{12} A \,b^{3}+\frac {2}{3} B \,a^{3}+\frac {1}{3} B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+108 b \left (\frac {\cos \left (3 d x +3 c \right )}{3}+\cos \left (d x +c \right )\right ) \left (A \,a^{2} b +\frac {1}{12} A \,b^{3}+\frac {2}{3} B \,a^{3}+\frac {1}{3} B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+24 \left (A b +\frac {B a}{4}\right ) d x \,a^{3} \cos \left (3 d x +3 c \right )+6 \left (a^{4} A +A \,b^{4}+4 B a \,b^{3}\right ) \sin \left (2 d x +2 c \right )+4 \left (6 A a \,b^{3}+9 B \,a^{2} b^{2}+B \,b^{4}\right ) \sin \left (3 d x +3 c \right )+3 a^{4} A \sin \left (4 d x +4 c \right )+72 \left (A b +\frac {B a}{4}\right ) d x \,a^{3} \cos \left (d x +c \right )+24 \sin \left (d x +c \right ) b^{2} \left (A a b +\frac {3}{2} B \,a^{2}+\frac {1}{2} b^{2} B \right )}{6 d \left (\cos \left (3 d x +3 c \right )+3 \cos \left (d x +c \right )\right )}\) \(295\)
risch \(4 A \,a^{3} b x +a^{4} x B -\frac {i a^{4} A \,{\mathrm e}^{i \left (d x +c \right )}}{2 d}+\frac {i a^{4} A \,{\mathrm e}^{-i \left (d x +c \right )}}{2 d}-\frac {i b^{2} \left (3 A \,b^{2} {\mathrm e}^{5 i \left (d x +c \right )}+12 B a b \,{\mathrm e}^{5 i \left (d x +c \right )}-24 A a b \,{\mathrm e}^{4 i \left (d x +c \right )}-36 B \,a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-48 A a b \,{\mathrm e}^{2 i \left (d x +c \right )}-72 B \,a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-12 B \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-3 A \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-12 B a b \,{\mathrm e}^{i \left (d x +c \right )}-24 A a b -36 B \,a^{2}-4 b^{2} B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}-\frac {6 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,a^{2} b^{2}}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A \,b^{4}}{2 d}-\frac {4 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B \,a^{3} b}{d}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B a \,b^{3}}{d}+\frac {6 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,a^{2} b^{2}}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A \,b^{4}}{2 d}+\frac {4 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B \,a^{3} b}{d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B a \,b^{3}}{d}\) \(411\)
norman \(\frac {\left (4 A \,a^{3} b +B \,a^{4}\right ) x +\left (-12 A \,a^{3} b -3 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}+\left (-12 A \,a^{3} b -3 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{8}+\left (4 A \,a^{3} b +B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{10}+\left (8 A \,a^{3} b +2 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}+\left (8 A \,a^{3} b +2 B \,a^{4}\right ) x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\frac {\left (2 a^{4} A -8 A a \,b^{3}+A \,b^{4}-12 B \,a^{2} b^{2}+4 B a \,b^{3}-2 B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{9}}{d}+\frac {\left (2 a^{4} A +8 A a \,b^{3}+A \,b^{4}+12 B \,a^{2} b^{2}+4 B a \,b^{3}+2 B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {2 \left (6 a^{4} A -A \,b^{4}-4 B a \,b^{3}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-\frac {4 \left (6 a^{4} A -12 A a \,b^{3}-18 B \,a^{2} b^{2}-B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{7}}{3 d}-\frac {4 \left (6 a^{4} A +12 A a \,b^{3}+18 B \,a^{2} b^{2}+B \,b^{4}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}{3 d}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right ) \left (-1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right )^{4}}-\frac {b \left (12 A \,a^{2} b +A \,b^{3}+8 B \,a^{3}+4 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {b \left (12 A \,a^{2} b +A \,b^{3}+8 B \,a^{3}+4 B a \,b^{2}\right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) \(506\)

[In]

int(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(a^4*A*sin(d*x+c)+B*a^4*(d*x+c)+4*A*a^3*b*(d*x+c)+4*B*a^3*b*ln(sec(d*x+c)+tan(d*x+c))+6*A*a^2*b^2*ln(sec(d
*x+c)+tan(d*x+c))+6*B*tan(d*x+c)*a^2*b^2+4*A*tan(d*x+c)*a*b^3+4*B*a*b^3*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(
d*x+c)+tan(d*x+c)))+A*b^4*(1/2*sec(d*x+c)*tan(d*x+c)+1/2*ln(sec(d*x+c)+tan(d*x+c)))-B*b^4*(-2/3-1/3*sec(d*x+c)
^2)*tan(d*x+c))

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 219, normalized size of antiderivative = 1.12 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {12 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (6 \, A a^{4} \cos \left (d x + c\right )^{3} + 2 \, B b^{4} + 4 \, {\left (9 \, B a^{2} b^{2} + 6 \, A a b^{3} + B b^{4}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \]

[In]

integrate(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(12*(B*a^4 + 4*A*a^3*b)*d*x*cos(d*x + c)^3 + 3*(8*B*a^3*b + 12*A*a^2*b^2 + 4*B*a*b^3 + A*b^4)*cos(d*x + c
)^3*log(sin(d*x + c) + 1) - 3*(8*B*a^3*b + 12*A*a^2*b^2 + 4*B*a*b^3 + A*b^4)*cos(d*x + c)^3*log(-sin(d*x + c)
+ 1) + 2*(6*A*a^4*cos(d*x + c)^3 + 2*B*b^4 + 4*(9*B*a^2*b^2 + 6*A*a*b^3 + B*b^4)*cos(d*x + c)^2 + 3*(4*B*a*b^3
 + A*b^4)*cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c)^3)

Sympy [F]

\[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{4} \cos {\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)*(a+b*sec(d*x+c))**4*(A+B*sec(d*x+c)),x)

[Out]

Integral((A + B*sec(c + d*x))*(a + b*sec(c + d*x))**4*cos(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.26 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {12 \, {\left (d x + c\right )} B a^{4} + 48 \, {\left (d x + c\right )} A a^{3} b + 4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} B b^{4} - 12 \, B a b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 3 \, A b^{4} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 24 \, B a^{3} b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 36 \, A a^{2} b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, A a^{4} \sin \left (d x + c\right ) + 72 \, B a^{2} b^{2} \tan \left (d x + c\right ) + 48 \, A a b^{3} \tan \left (d x + c\right )}{12 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="maxima")

[Out]

1/12*(12*(d*x + c)*B*a^4 + 48*(d*x + c)*A*a^3*b + 4*(tan(d*x + c)^3 + 3*tan(d*x + c))*B*b^4 - 12*B*a*b^3*(2*si
n(d*x + c)/(sin(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) - 3*A*b^4*(2*sin(d*x + c)/(si
n(d*x + c)^2 - 1) - log(sin(d*x + c) + 1) + log(sin(d*x + c) - 1)) + 24*B*a^3*b*(log(sin(d*x + c) + 1) - log(s
in(d*x + c) - 1)) + 36*A*a^2*b^2*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + 12*A*a^4*sin(d*x + c) + 72*
B*a^2*b^2*tan(d*x + c) + 48*A*a*b^3*tan(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 387 vs. \(2 (187) = 374\).

Time = 0.37 (sec) , antiderivative size = 387, normalized size of antiderivative = 1.98 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {\frac {12 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1} + 6 \, {\left (B a^{4} + 4 \, A a^{3} b\right )} {\left (d x + c\right )} + 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (8 \, B a^{3} b + 12 \, A a^{2} b^{2} + 4 \, B a b^{3} + A b^{4}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (36 \, B a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 24 \, A a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 12 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 72 \, B a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 48 \, A a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 36 \, B a^{2} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 24 \, A a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 \, B a b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, A b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, B b^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*sec(d*x+c))^4*(A+B*sec(d*x+c)),x, algorithm="giac")

[Out]

1/6*(12*A*a^4*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 + 1) + 6*(B*a^4 + 4*A*a^3*b)*(d*x + c) + 3*(8*B*a^3
*b + 12*A*a^2*b^2 + 4*B*a*b^3 + A*b^4)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 3*(8*B*a^3*b + 12*A*a^2*b^2 + 4*B*
a*b^3 + A*b^4)*log(abs(tan(1/2*d*x + 1/2*c) - 1)) - 2*(36*B*a^2*b^2*tan(1/2*d*x + 1/2*c)^5 + 24*A*a*b^3*tan(1/
2*d*x + 1/2*c)^5 - 12*B*a*b^3*tan(1/2*d*x + 1/2*c)^5 - 3*A*b^4*tan(1/2*d*x + 1/2*c)^5 + 6*B*b^4*tan(1/2*d*x +
1/2*c)^5 - 72*B*a^2*b^2*tan(1/2*d*x + 1/2*c)^3 - 48*A*a*b^3*tan(1/2*d*x + 1/2*c)^3 - 4*B*b^4*tan(1/2*d*x + 1/2
*c)^3 + 36*B*a^2*b^2*tan(1/2*d*x + 1/2*c) + 24*A*a*b^3*tan(1/2*d*x + 1/2*c) + 12*B*a*b^3*tan(1/2*d*x + 1/2*c)
+ 3*A*b^4*tan(1/2*d*x + 1/2*c) + 6*B*b^4*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*x + 1/2*c)^2 - 1)^3)/d

Mupad [B] (verification not implemented)

Time = 16.74 (sec) , antiderivative size = 636, normalized size of antiderivative = 3.26 \[ \int \cos (c+d x) (a+b \sec (c+d x))^4 (A+B \sec (c+d x)) \, dx=\frac {\frac {A\,a^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {A\,a^4\,\sin \left (4\,c+4\,d\,x\right )}{8}+\frac {A\,b^4\,\sin \left (2\,c+2\,d\,x\right )}{4}+\frac {B\,b^4\,\sin \left (3\,c+3\,d\,x\right )}{6}+\frac {B\,b^4\,\sin \left (c+d\,x\right )}{2}+A\,a\,b^3\,\sin \left (c+d\,x\right )+\frac {3\,B\,a^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}-\frac {A\,b^4\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}}{4}+A\,a\,b^3\,\sin \left (3\,c+3\,d\,x\right )+B\,a\,b^3\,\sin \left (2\,c+2\,d\,x\right )+\frac {3\,B\,a^2\,b^2\,\sin \left (c+d\,x\right )}{2}+\frac {B\,a^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )}{2}-\frac {A\,b^4\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}}{4}+\frac {3\,B\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{2}+2\,A\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )-A\,a^2\,b^2\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,9{}\mathrm {i}-B\,a\,b^3\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,1{}\mathrm {i}-B\,a^3\,b\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,2{}\mathrm {i}-A\,a^2\,b^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,\cos \left (3\,c+3\,d\,x\right )\,3{}\mathrm {i}+6\,A\,a^3\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )-B\,a\,b^3\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,3{}\mathrm {i}-B\,a^3\,b\,\cos \left (c+d\,x\right )\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\,6{}\mathrm {i}}{d\,\left (\frac {3\,\cos \left (c+d\,x\right )}{4}+\frac {\cos \left (3\,c+3\,d\,x\right )}{4}\right )} \]

[In]

int(cos(c + d*x)*(A + B/cos(c + d*x))*(a + b/cos(c + d*x))^4,x)

[Out]

((A*a^4*sin(2*c + 2*d*x))/4 + (A*a^4*sin(4*c + 4*d*x))/8 + (A*b^4*sin(2*c + 2*d*x))/4 + (B*b^4*sin(3*c + 3*d*x
))/6 + (B*b^4*sin(c + d*x))/2 + A*a*b^3*sin(c + d*x) + (3*B*a^4*cos(c + d*x)*atan(sin(c/2 + (d*x)/2)/cos(c/2 +
 (d*x)/2)))/2 - (A*b^4*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*3i)/4 + A*a*b^3*sin(3*c +
 3*d*x) + B*a*b^3*sin(2*c + 2*d*x) + (3*B*a^2*b^2*sin(c + d*x))/2 + (B*a^4*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (
d*x)/2))*cos(3*c + 3*d*x))/2 - (A*b^4*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)*1i)/4
+ (3*B*a^2*b^2*sin(3*c + 3*d*x))/2 + 2*A*a^3*b*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x) -
A*a^2*b^2*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*9i - B*a*b^3*atan((sin(c/2 + (d*x)/2)*
1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)*1i - B*a^3*b*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c
 + 3*d*x)*2i - A*a^2*b^2*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*cos(3*c + 3*d*x)*3i + 6*A*a^3*b*cos(
c + d*x)*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)) - B*a*b^3*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c
/2 + (d*x)/2))*3i - B*a^3*b*cos(c + d*x)*atan((sin(c/2 + (d*x)/2)*1i)/cos(c/2 + (d*x)/2))*6i)/(d*((3*cos(c + d
*x))/4 + cos(3*c + 3*d*x)/4))